function slideSwitch(idBig,idSmall,prev,next,numVar,pWidth){
	function G(s){
		return document.getElementById(s);
	}
	
	function getStyle(obj, attr){
		if(obj.currentStyle){
			return obj.currentStyle[attr];
		}else{
			return getComputedStyle(obj, false)[attr];
		}
	}
	
	function Animate(obj, json){
		if(obj.timer){
			clearInterval(obj.timer);
		}
		obj.timer = setInterval(function(){
			for(var attr in json){
				var iCur = parseInt(getStyle(obj, attr));
				iCur = iCur ? iCur : 0;
				var iSpeed = (json[attr] - iCur) / 5;
				iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
				obj.style[attr] = iCur + iSpeed + 'px';
				if(iCur == json[attr]){
					clearInterval(obj.timer);
				}
			}
		}, 30);
	}

	var oPic = G(idBig);
	var oList = G(idSmall);
	var oPrev = G(prev);
	var oNext = G(next);
	var oSwitch = G("exchange");

	var oPicLi = oPic.getElementsByTagName("li");
	var oListLi = oList.getElementsByTagName("li");
	var len1 = oPicLi.length;
	var len2 = oListLi.length;
	
	var oPicUl = oPic.getElementsByTagName("ul")[0];
	var oListUl = oList.getElementsByTagName("ul")[0];
	var w1 = oPicLi[0].offsetWidth;
	var w2 = oListLi[0].offsetWidth;

	oPicUl.style.width = w1 * len1 + "px";
	oListUl.style.width =(w2 + pWidth )*len2 + "px";

	var index = 0;
	
	var num = numVar;
	var num2 = Math.ceil(num / 2);

	function Change(){

		Animate(oPicUl, {left: - index * w1});
		
		if(index < num2){
			Animate(oListUl, {left: 0});
		}else if(index + num2 <= len2){
			Animate(oListUl, {left: - (index - num2 + 1) * (w2+pWidth)});
		}else{
			Animate(oListUl, {left: - (len2 - num) * (w2+pWidth)});
		}

		for (var i = 0; i < len2; i++) {
			oListLi[i].className = "";
			if(i == index){
				oListLi[i].className = "cur";
			}
		}
	}
	
	oNext.onclick = function(){
		index ++;
		index = index == len2 ? 0 : index;
		Change();
	}
	
	oPrev.onclick = function(){
		index --;
		index = index == -1 ? len2 -1 : index;
		Change();
	}

	if(oSwitch){
		oSwitch.onclick=function(){
		index = (index>4) ? index%4 : index+=4;
		index = index == len2 ? 0 : index;
		Change();
			}
		}
	
	for (var i = 0; i < len2; i++) {
		oListLi[i].index = i;
		oListLi[i].onclick = function(){
			index = this.index;
			Change();
		}
	}
	
}
/*病友分享上面 外部翻滚效果*/
function slideSwitchwq(idBig,idSmall,numVar,pWidth){
	
	function G(s){
		return document.getElementById(s);
	}
	
	function getStyle(obj, attr){
		if(obj.currentStyle){
			return obj.currentStyle[attr];
		}else{
			return getComputedStyle(obj, false)[attr];
		}
	}
	
	function Animate(obj, json){
		if(obj.timer){
			clearInterval(obj.timer);
		}
		obj.timer = setInterval(function(){
			for(var attr in json){
				var iCur = parseInt(getStyle(obj, attr));
				iCur = iCur ? iCur : 0;
				var iSpeed = (json[attr] - iCur) / 5;
				iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
				obj.style[attr] = iCur + iSpeed + 'px';
				if(iCur == json[attr]){
					clearInterval(obj.timer);
				}
			}
		}, 30);
	}

	var oPic = G(idBig);
	var oList = G(idSmall);
	var oSwitch = G("exchange");

	var oPicLi = oPic.getElementsByTagName("dt");
	var oListLi = oList.getElementsByTagName("li");
	var len1 = oPicLi.length;
	var len2 = oListLi.length;
	
	var oPicUl = oPic.getElementsByTagName("dl")[0];
	var oListUl = oList.getElementsByTagName("ul")[0];
	var w1 = oPicLi[0].offsetWidth;
	var w2 = oListLi[0].offsetWidth;

	oPicUl.style.width = w1 * len1 + "px";
	oListUl.style.width =(w2 + pWidth )*len2 + "px";

	var index = 0;
	
	var num = numVar;
	var num2 = Math.ceil(num / 2);

	function Change(){

		Animate(oPicUl, {left: - index * w1});
		
		if(index < num2){
			Animate(oListUl, {left: 0});
		}else if(index + num2 <= len2){
			Animate(oListUl, {left: - (index - num2 + 1) * (w2+pWidth)});
		}else{
			Animate(oListUl, {left: - (len2 - num) * (w2+pWidth)});
		}

		for (var i = 0; i < len2; i++) {
			oListLi[i].className = "";
			if(i == index){
				oListLi[i].className = "cur";
			}
		}
	}

	if(oSwitch){
		oSwitch.onclick=function(){
		index+=4;
		index = index == len2 ? 0 : index;
		Change();
			}
		}
	
	for (var i = 0; i < len2; i++) {
		oListLi[i].index = i;
		oListLi[i].onclick = function(){
			index = this.index;
			Change();
		}
	}
	
}
/*病友分享上面 内部翻滚效果*/
function slideSwitchwqin(idBig,idSmall,numVar,pWidth){
	function G(s){
		return document.getElementById(s);
	}
	
	function getStyle(obj, attr){
		if(obj.currentStyle){
			return obj.currentStyle[attr];
		}else{
			return getComputedStyle(obj, false)[attr];
		}
	}
	
	function Animate(obj, json){
		if(obj.timer){
			clearInterval(obj.timer);
		}
		obj.timer = setInterval(function(){
			for(var attr in json){
				var iCur = parseInt(getStyle(obj, attr));
				iCur = iCur ? iCur : 0;
				var iSpeed = (json[attr] - iCur) / 5;
				iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
				obj.style[attr] = iCur + iSpeed + 'px';
				if(iCur == json[attr]){
					clearInterval(obj.timer);
				}
			}
		}, 30);
	}

	var oPic = G(idBig);
	var oList = G(idSmall);

	var oPicLi = oPic.getElementsByTagName("li");
	var oListLi = oList.getElementsByTagName("li");
	var len1 = oPicLi.length;
	var len2 = oListLi.length;
	
	var oPicUl = oPic.getElementsByTagName("ul")[0];
	var oListUl = oList.getElementsByTagName("ul")[0];
	var w1 = oPicLi[0].offsetWidth;
	var w2 = oListLi[0].offsetWidth;

	oPicUl.style.width = w1 * len1 + "px";
	oListUl.style.width =(w2 + pWidth ) * 2 + "px";

	var index = 0;
	
	var num = numVar;
	var num2 = Math.ceil(num / 2);

	function Change(){

		Animate(oPicUl, {left: - index * w1});
		
		if(index < num2){
			Animate(oListUl, {left: 0});
		}else if(index + num2 <= len2){
			Animate(oListUl, {left: - (index - num2 + 1) * w2});
		}else{
			Animate(oListUl, {left: - (len2 - num) * w2});
		}

		for (var i = 0; i < len2; i++) {
			oListLi[i].className = "";
			if(i == index){
				oListLi[i].className = "on";
			}
		}
	}
	for (var i = 0; i < len2; i++) {
		oListLi[i].index = i;
		oListLi[i].onclick = function(){
			index = this.index;
			Change();
		}
	}

}

/*
function slideSwitch(idBig,idSmall,prev,next,numVar,pWidth){
	
	function G(s){
		return document.getElementById(s);
	}
	
	function getStyle(obj, attr){
		if(obj.currentStyle){
			return obj.currentStyle[attr];
		}else{
			return getComputedStyle(obj, false)[attr];
		}
	}
	
	function Animate(obj, json){
		if(obj.timer){
			clearInterval(obj.timer);
		}
		obj.timer = setInterval(function(){
			for(var attr in json){
				var iCur = parseInt(getStyle(obj, attr));
				iCur = iCur ? iCur : 0;
				var iSpeed = (json[attr] - iCur) / 5;
				iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
				obj.style[attr] = iCur + iSpeed + 'px';
				if(iCur == json[attr]){
					clearInterval(obj.timer);
				}
			}
		}, 30);
	}

	var oPic = G(idBig);
	var oList = G(idSmall);
	var oPrev = G(prev);
	var oNext = G(next);
	var oSwitch = G("exchange");

	var oPicLi = oPic.getElementsByTagName("li");
	var oListLi = oList.getElementsByTagName("li");
	var len1 = oPicLi.length;
	var len2 = oListLi.length;
	
	var oPicUl = oPic.getElementsByTagName("ul")[0];
	var oListUl = oList.getElementsByTagName("ul")[0];
	var w1 = oPicLi[0].offsetWidth;
	var w2 = oListLi[0].offsetWidth;

	oPicUl.style.width = w1 * len1 + "px";
	oListUl.style.width =(w2 + pWidth )*len2 + "px";

	var index = 0;
	
	var num = numVar;
	var num2 = Math.ceil(num / 2);

	function Change(){

		Animate(oPicUl, {left: - index * w1});
		
		if(index < num2){
			Animate(oListUl, {left: 0});
		}else if(index + num2 <= len2){
			Animate(oListUl, {left: - (index - num2 + 1) * (w2+pWidth)});
		}else{
			Animate(oListUl, {left: - (len2 - num) * (w2+pWidth)});
		}

		for (var i = 0; i < len2; i++) {
			oListLi[i].className = "";
			if(i == index){
				oListLi[i].className = "cur";
			}
		}
	}
	
	oNext.onclick = function(){
		index ++;
		index = index == len2 ? 0 : index;
		Change();
	}
	
	oPrev.onclick = function(){
		index --;
		index = index == -1 ? len2 -1 : index;
		Change();
	}

	if(oSwitch){
		oSwitch.onclick=function(){
		index+=4;
		index = index == len2 ? 0 : index;
		Change();
			}
		}
	
	for (var i = 0; i < len2; i++) {
		oListLi[i].index = i;
		oListLi[i].onclick = function(){
			index = this.index;
			Change();
		}
	}
	
}*/

/*设备列表页下面效果*/
function slideSwitchdouble(idBig,idSmall,prev,next,numVar,pWidth){
	function G(s){
		return document.getElementById(s);
	}
	
	function getStyle(obj, attr){
		if(obj.currentStyle){
			return obj.currentStyle[attr];
		}else{
			return getComputedStyle(obj, false)[attr];
		}
	}
	
	function Animate(obj, json){
		if(obj.timer){
			clearInterval(obj.timer);
		}
		obj.timer = setInterval(function(){
			for(var attr in json){
				var iCur = parseInt(getStyle(obj, attr));
				iCur = iCur ? iCur : 0;
				var iSpeed = (json[attr] - iCur) / 5;
				iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
				obj.style[attr] = iCur + iSpeed + 'px';
				if(iCur == json[attr]){
					clearInterval(obj.timer);
				}
			}
		}, 30);
	}

	var oPic = G(idBig);
	var oList = G(idSmall);
	var oPrev = G(prev);
	var oNext = G(next);
	var oSwitch = G("exchange");

	var oPicLi = oPic.getElementsByTagName("li");
	var oListLi = oList.getElementsByTagName("li");
	var len1 = oPicLi.length;
	var len2 = oListLi.length;
	
	var oPicUl = oPic.getElementsByTagName("ul")[0];
	var oListUl = oList.getElementsByTagName("ul")[0];
	var w1 = oPicLi[0].offsetWidth;
	var w2 = oListLi[0].offsetWidth;

	oPicUl.style.width = w1 * len1 + "px";


	var index = 0;
	
	var num = numVar;
	var num2 = Math.ceil(num / 2);

	function Change(){

		Animate(oPicUl, {left: - index * w1});
		
		if(index < num2){
			Animate(oListUl, {left: 0});
		}else if(index + num2 <= len2){
			Animate(oListUl, {left: - (index - num2 + 1) * (w2+pWidth)});
		}else{
			Animate(oListUl, {left: - (len2 - num) * (w2+pWidth)});
		}

		for (var i = 0; i < len2; i++) {
			oListLi[i].className = "";
			if(i == index){
				oListLi[i].className = "cur";
			}
		}
	}
	
	oNext.onclick = function(){
		index ++;
		index = index == len2 ? 0 : index;
		Change();
	}
	
	oPrev.onclick = function(){
		index --;
		index = index == -1 ? len2 -1 : index;
		Change();
	}

	if(oSwitch){
		oSwitch.onclick=function(){
		index+=4;
		index = index == len2 ? 0 : index;
		Change();
			}
		}
	
	for (var i = 0; i < len2; i++) {
		oListLi[i].index = i;
		oListLi[i].onclick = function(){
			index = this.index;
			Change();
		}
	}
	
}
(function weixin(){
	var $wx=$("#left-wx"),$suspend=$("#suspend"),/*_back=document.getElementById("back"),*/_aH=document.body.clientHeight,$num=$("#sp-num");
	var begin=setInterval(function(){
	 var num=Math.floor(Math.random()*10+50);
	 $num.text(num);
	 },3000);
	 var isIE=!!window.ActiveXObject;
	$suspend.css("bottom",(document.documentElement.clientHeight-392)+"px");
	window.onscroll=function(){
		if((document.body.scrollTop||document.documentElement.scrollTop)>100){
			$wx.slideDown(350);
			}else{
			$wx.hide();	
				}
		if((document.body.scrollTop||document.documentElement.scrollTop)>(document.body.clientHeight-document.documentElement.clientHeight-520)){
			$wx.css({"bottom":"520px","position":"absolute"});
			if(isIE&&!window.XMLHttpRequest){
				$wx.removeClass("ie6-l");
				}
			}else{
			if(isIE&&!window.XMLHttpRequest){
				/*$wx.css({"top":(document.documentElement.scrollTop+document.documentElement.clientHeight-$wx[0].offsetHeight-(parseInt($wx[0].currentStyle.marginTop, 10)||0)-(parseInt($wx[0].currentStyle.marginBottom, 10)||0))});*/
				$wx.addClass("ie6-l");
				}else{
					$wx.css({"bottom":"0","position":"fixed"});
					}
				}
		if((document.body.scrollTop||document.documentElement.scrollTop)>(document.body.clientHeight-1092)){
			if(isIE&&!window.XMLHttpRequest){
				$suspend.removeClass("ie6-r");
				$suspend.addClass("ie6-r2");
				//$suspend.css("top",(document.documentElement.scrollTop+document.documentElement.clientHeight-882));
				}else{
					$suspend.css({"bottom":"520px","position":"absolute"});
					}
			}else{
				if(isIE&&!window.XMLHttpRequest){
				/*$suspend.css({"top":(document.documentElement.scrollTop+30)+"px"});*/
				$suspend.removeClass("ie6-r2");
				$suspend.addClass("ie6-r");
				}else{
				$suspend.css({"bottom":(document.documentElement.clientHeight-392)+"px","position":"fixed"});
					}
				}					
		}
	/*_back.onclick=function(){
		moveTop();
		}*/
		$.showBlock("#wx-a","#left-wx","a",".wx-pic","cur");
		var $getA=$("#wx-a"),$getDiv=$("#left-wx"),$getA2=$getA.find("a"),$getDiv2=$getDiv.find(".wx-pic");
		$getDiv.find(".wx-pic").mouseover(function(){
			if($(this).index()!=0){
				$(this).show();
				}else{
					$getA2.removeClass("cur");$getDiv2.removeAttr("style");$getA2.eq(1).addClass("cur");$getDiv2.eq(1).show();
					}
			});
		$getDiv.hover(function(){},function(){$getA2.removeClass("cur");$getDiv2.removeAttr("style");$getA2.eq(1).addClass("cur");$getDiv2.eq(1).show();});	
	})();
function moveTop(){
	var timer=null;
	timer=setInterval(function(){
		var iSpeed=(document.body.scrollTop||document.documentElement.scrollTop)/8;
		iSpeed=iSpeed>0?Math.ceil(iSpeed):Math.floor(iSpeed);
		document.body.scrollTop=(document.body.scrollTop-iSpeed);
		document.documentElement.scrollTop=(document.documentElement.scrollTop-iSpeed);
		if((document.body.scrollTop||document.documentElement.scrollTop)==0){
			clearInterval(timer);
			}
		},30);
	}	
